/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import { request } from '@umijs/max';

// 登录查询用户信息
export async function queryUser(params: Pick<User.UserEntity, 'id'>) {
  return request<Global.Result<User.UserEntity>>(
    `/api/getUserInfo?id=${params?.id}`,
    {
      method: 'get',
    },
  );
}

// 用户管理查询用户
export async function queryUserList(data: Global.pageParams) {
  return request<Global.Result<User.UserEntity[]>>('/api/queryUserList', {
    method: 'post',
    data,
  });
}

export async function addUser(data: User.UserEntity) {
  return request<Global.Result<User.UserEntity>>('/api/createUser', {
    method: 'post',
    data,
  });
}

export async function batchAddUser(data: User.UserEntity) {
  return request<Global.Result<User.UserEntity>>('/api/batchCreateUser', {
    method: 'post',
    data,
  });
}

export async function editUser(data: User.UserEntity) {
  return request<Global.Result<User.UserEntity>>(`/api/updateUser`, {
    method: 'patch',
    data: data,
  });
}

export async function delUser(data: Pick<User.UserEntity, 'id'>) {
  const { id } = data;
  return request<Global.Result<User.UserEntity>>(`/api/destroyUser/${id}`, {
    method: 'delete',
  });
}
